<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
        <el-form-item label="大厅面积">
          <el-input v-model="form.area" style="width: 370px;" />
        </el-form-item>
        <el-form-item label="入住部门">
          <el-input v-model="form.department" style="width: 370px;" />
        </el-form-item>
        <el-form-item label="工作人员">
          <el-input v-model="form.woker" style="width: 370px;" />
        </el-form-item>
        <el-form-item label="综合和处理窗口">
          <el-input v-model="form.integratedWindow" style="width: 370px;" />
        </el-form-item>
        <el-form-item>
          <div class="btns">
            <el-button :loading="crud.cu === 2" type="primary" @click="submit">确认</el-button>
          </div>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import crudYlDatakbHallInformation from '@/api/ylDatakbHallInformation'
import CRUD, { presenter, header, form, crud } from '@crud/crud'

const defaultForm = { id: null, area: null, department: null, woker: null, integratedWindow: null, createTime: null, updateTime: null, creatorId: null, modiflerId: null }
export default {
  name: 'YlDatakbHallInformation',
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '大厅信息', url: 'api/ylDatakbHallInformation', sort: 'id,desc', crudMethod: { ...crudYlDatakbHallInformation }})
  },
  data() {
    return {
      permission: {
        add: ['admin', 'ylDatakbHallInformation:add'],
        edit: ['admin', 'ylDatakbHallInformation:edit'],
        del: ['admin', 'ylDatakbHallInformation:del']
      },
      rules: {
      }}
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    [CRUD.HOOK.afterRefresh]() {
      console.log(this.form, this.crud.data, this.table)
      this.form = this.crud.data[0]
      return true
    },
    submit() {
      crudYlDatakbHallInformation.edit(this.form).then(res => {
        this.crud.editSuccessNotify()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.head-container{
  display: flex;
  justify-content: center;
  padding-top: 20px;
  .btns{
    display: flex;
    justify-content: flex-end;
  }
}
</style>
